package com.xcity.pomelo.response;

import java.util.Collections;
import java.util.List;

import com.xcity.game.activity2.share.ShareAction;
import com.xcity.game.activity2.share.action.QQShareAction;
import com.xcity.game.activity2.share.template.QQShareActivityTemplate;
import com.xcity.game.item.ItemInfo;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class Share2Response extends Response {
	
	// 类型（原样返回请求类型 @see Share2Request#type）
	public byte type;
	
	// 分享任务id
	public int id;
	// 任务名
	public String name;
	// 奖励信息
	public int gold;
	public int stone;
	public List<ItemInfo> items;
	// 状态（0-未分享不能领奖，1-可领奖，2-已领奖）
	public byte state;
	public int count;
	public int maxCount;
	
	public Share2Response(int serial, byte type, int id) {
		this(serial, type, id, "", 0, 0, null, ShareAction.STATE_CAN_NOT_REWARD, 0, 0);
	}
	
	public Share2Response(int serial, byte type, QQShareActivityTemplate template, byte state, int count) {
		this(serial, type, template.getId(), template.getName(), template.getGold(), template.getStone(), template.getItemList(), state, count, QQShareAction.getMaxCount(template));
	}
	
	public Share2Response(int serial, byte type, int id, String name, int gold, int stone, List<ItemInfo> items, byte state, int count, int maxCount) {
		super(serial);
		this.type = type;
		this.id = id;
		this.name = name;
		this.gold = gold;
		this.stone = stone;
		this.items = items != null ? items : Collections.emptyList();
		this.state = state;
		this.count = count;
		this.maxCount = maxCount;
	}

}
